

package com.hazelcast.config;

/**
 * The ConfigPatternMatcher provides a strategy to match an item name
 * to a configuration pattern.
 * <p>
 * It is used on each Config.getXXXConfig() and ClientConfig.getXXXConfig()
 * call for any data structure. It is supplied a list of config patterns
 * and the name of the item that the configuration is requested for.
 * <p>
 * Default matcher is {@link com.hazelcast.config.matcher.MatchingPointConfigPatternMatcher}.
 */
@FunctionalInterface
public interface ConfigPatternMatcher {

    /**
     * Returns the best match for an item name out of a list of configuration patterns.
     *
     * @param configPatterns list of known configuration patterns
     * @param itemName       item name to match
     * @return a key of configPatterns which matches
     * the item name or {@code null} if there
     * is no match
     * @throws InvalidConfigurationException if ambiguous configurations are found
     */
    String matches(Iterable<String> configPatterns, String itemName) throws InvalidConfigurationException;
}
